package zy1208.zy26;

import java.io.FileInputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Properties;
import java.util.Set;

public class demo {
    public static void main(String[] args) throws Exception {
        Properties p = new Properties();
        FileInputStream f = new FileInputStream("D:\\ideadashuju12\\liu_ya_kai\\src\\zy1208\\zy26\\data.properties");
        p.load(f);
        f.close();
        Set<String> set = p.stringPropertyNames();
        Class<?> aClass = Class.forName("zy1208.zy26.User");
        Object o = aClass.newInstance();
        Method toString = aClass.getDeclaredMethod("toString");
        for (String s : set) {
            Field f1 = aClass.getDeclaredField(s);
            f1.setAccessible(true);
            f1.set(o,p.getProperty(s));
        }
        Object o1 = toString.invoke(o);
        System.out.println(o1);
    }
}
